This forum is closed to new posts and
responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:
Subject: Trying to read Active Directory using lotusscript
Feedback Type: Question
Product Area: Other
Technical Area: Application Development
Platform: Windows
Release: 8.5.2
Reproducible: Always
I am trying to read/query active directory using lotusscript. but i am getting an error when i am trying to excute -->Set objRecordSet = objCommand.Execute .
Error is "Active Directory: A Referral Was Returned From The Server"
here is the code
Dim objConnection As Variant
Dim objCommand As Variant
Dim objRecordSet As Variant
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
'Modify the Next line's dc and username (sAMAccountName) to match your environment
objCommand.CommandText = "<GC://dc=usdcserver,dc=com>;" & _
"(&(objectCategory=person)(objectClass=user)" & _
"(sAMAccountName=johndoe));" & _
"sAMAccountName, distinguishedName;subtree"
Set objRecordSet = objCommand.Execute
If objRecordSet.RecordCount = 0 Then
MsgBox "The sAMAccountName is not in use."
Else
While Not objRecordset.EOF
MsgBox "sAMAccountName = " & _
objRecordset.Fields("sAMAccountName").value
MsgBox "distinguishedName = " & _
objRecordset.Fields("distinguishedName").value
objRecordset.MoveNext
Wend
End If
objConnection.Close
objRecordSet.close
Feedback number WEBB8JRRYT created by ~Mario Zekgerotex on 07/14/2011
Status: Open
Comments: